<template>
  <div>
    <el-form label-width="100px" :model="form">
      <el-row style="border-bottom: 1.5px solid #f4f6f8;">
        <el-row>
          <el-col :span="6" style="margin-right: 20px;">
            <div class="grid-content bg-purple">
              <el-form-item label="车牌号码：">
                <el-input v-model="form.carNumber" placeholder="请输入车牌号码" />
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="6">
            <div class="grid-content bg-purple-light">
              <el-form-item label="缴费状态：">
                <el-select v-model="form.paymentStatus" placeholder="请选择缴费状态：">
                  <el-option v-for="item in selectList" :key="item.id" :label="item.type" :value="item.id" />
                </el-select></el-form-item>
            </div>
          </el-col>
          <el-col :span="6" style="margin-left: -80px !important;">
            <div class="grid-content bg-purple-light"><el-form-item>
              <el-button type="primary" @click.prevent="getListA">查询</el-button>
            </el-form-item></div>
          </el-col>
        </el-row>
      </el-row>
    </el-form>

    <div style="margin-top: 20px;">
      <el-row>
        <el-table style="width: 100%" :data="list">
          <el-table-column type="index" label="序号" width="100" />
          <!--  -->
          <el-table-column prop="carNumber" label="车牌号码" />
          <el-table-column prop="chargeType" label="收费类型" />
          <el-table-column prop="parkingTime" label="停车总时长" />
          <el-table-column prop="actualCharge" label="缴纳用费(元)" />
          <el-table-column prop="paymentStatus" label="缴费状态">
            <template #default="obj">
              {{ obj.paymentStatus==='0'?'未缴纳':'已缴纳' }}
            </template>
          </el-table-column>
          <el-table-column prop="paymentMethod" label="缴费方式">
            <template #default="{row}">
              {{ getMethod( row.paymentMethod) }}
            </template>
          </el-table-column>
          <el-table-column prop="paymentTime" label="缴费时间" />

        </el-table>
      </el-row>
    </div>
  </div>
</template>
<script>
import { getList } from '@/api/carpay'
export default {
  name: 'CarPayPage',
  data() {
    return {
      form: {
        page: 1,
        pageSize: 10,
        carNumber: '',
        paymentStatus: ''
      },
      list: [],
      selectList: [
        { id: null, type: '全部' },
        { id: 0, type: '未缴纳' },
        { id: 1, type: '已缴纳' }
      ]
    }
  },
  created() {
    this.getListA()
  },
  methods: {
    async getListA() {
      const res = await getList(this.form)
      this.list = res.data.rows
    },
    // 枚举
    getMethod(type) {
      const TYPE = {
        null: '--',
        'Alipay': '支付宝',
        'WeChat': '微信',
        'Cash': '线下'
      }
      return TYPE[type]
    }
  }
}
</script>
<style lang="scss" scoped>
</style>
